import React, { PureComponent } from 'react';
import { TabBar, Icon,Flex } from 'antd-mobile';
import { nav_bottom_bar, nav_bottom_bar_X, cart_link_s,diliweizhi } from './NavBottomBar.less';
import { connect } from 'dva';
import { routerRedux } from 'dva/router';
import cartsvg from '../../assets/svg/cart.svg';
import cartSelectedsvg from '../../assets/svg/cartSelected.svg';
import conversation from '../../assets/svg/conversation.svg';
import location1 from '../../assets/svg/location-1.svg';
import hweixiao from '../../assets/svg/hweixiao.svg';
import hfenlei from '../../assets/svg/hfenlei.svg';
import guanliangoods from '../../assets/svg/guanliangoods.svg';
import dili from '../../assets/svg/dili.svg';
import picture1 from '../../assets/svg/picture1.svg';
import shot1 from '../../assets/svg/shot1.svg';

import equi from '../../utils/judgmentEquipment';
console.log(equi());

class PublishNavBar extends PureComponent {
    constructor(props){
        super(props);
        this.state={
            e:1
        };

    }

    componentDidMount() {

    }

    render() {
        const { path, dispatch } = this.props;
        console.log(this.props.address)
        return (
            <div className={equi() ? nav_bottom_bar_X : nav_bottom_bar}>
                <Flex wrap="wrap" style={{background:"#fff",padding:".3rem"}}>
                    {this.props.code.map((r,x)=>{
                        return <Flex key={x} style={{color:"#0BA6E8",marginRight:".2rem",fontSize:".3rem"}}>
                            #{this.props.decodeUnicode(r)}#
                        </Flex>
                    })}
                </Flex>
                <Flex justify="between" style={{background:"#fff",padding:".3rem"}}>
                    <Flex style={{border:"1px solid #999",borderRadius:".4rem",padding:".05rem .3rem",fontSize:".3rem"}} justify="around" onClick={()=>{
                        this.props.showModal();
                    }}>
                        {this.props.model=="选择模块"?<Icon type={hfenlei.id} style={{width:".3rem",height:".3rem",marginRight:".1rem"}}/>:""}
                        <div>{this.props.model}</div>
                    </Flex>
                    <Flex style={{background:"#f7f7f7",color:"#666",borderRadius:".4rem",width:"2.5rem",padding:".1rem .3rem",fontSize:".3rem"}} justify="around" onClick={()=>{
                        this.props.getPosition();
                        if(this.state.e==1)this.setState({e:0})
                        else this.setState({e:1})
                    }}>
                        <Icon type={dili.id} style={{width:".3rem",height:".3rem"}}/>
                        {this.props.address==""?<div className={diliweizhi}>获取地理位置</div>:<div className={diliweizhi}>{this.props.address}</div>}
                    </Flex>
                </Flex>
                <TabBar
                    unselectedTintColor="#949494"
                    tintColor="#ff0036"
                    barTintColor="#f6f6f6"
                    hidden={false}
                >
                    {/*<TabBar.Item*/}
                        {/*icon={<Icon  type={hweixiao.id} onClick={()=>{*/}

                        {/*}}/>}*/}
                        {/*onPress={() => {*/}

                        {/*}}*/}
                        {/*data-seed="logId"*/}
                    {/*/>*/}
                    {/*<TabBar.Item*/}
                        {/*icon={<div style={{position:"relative"}}>*/}
                            {/*<Icon  type={picture1.id}></Icon>*/}
                            {/*<label htmlFor="file" style={{opacity:"0",display:"block",width:"100%",height:"100%",position:"absolute",top:"0",left:"0"}}></label>*/}
                        {/*</div>}*/}

                        {/*onPress={() => {*/}
                            {/*this.props.picker();*/}
                        {/*}}*/}
                        {/*data-seed="logId1"*/}
                    {/*/>*/}
                    <TabBar.Item
                        icon={<div style={{position:"relative"}}>
                            <Icon  type={shot1.id}></Icon>
                            <label htmlFor={this.props.data==0||this.props.data==1?"file":this.props.data==2?"videoFile":"contentFile"} style={{opacity:"0",display:"block",width:"100%",height:"100%",position:"absolute",top:"0",left:"0"}}></label>
                        </div>}
                        onPress={() => {

                        }}
                    />
                    <TabBar.Item
                        icon={<Icon  type={conversation.id} />}
                        onPress={() => {
                            this.props.showModal1();
                        }}
                    />
                    <TabBar.Item
                        icon={<Icon  type={guanliangoods.id} style={this.props.data==3?{}:{opacity:"0"}}/>}
                        onPress={() => {
                            if(this.props.data==3){
                                this.props.showModal2();
                                this.props.qingkong();
                                this.props.refresh();
                            }

                        }}
                    />


                </TabBar>
            </div>

        );
    }
}

export default connect(({ app }) => ({ app }))(PublishNavBar);